<?php

class Core_Data_UDD_Structure_Table {

    private $Document;
    private $Database;
    private $FieldCollection;

    private $strName;
    private $strPrefix;
    private $objParent;

    function __construct ( Core_Data_UDD_Structure_Document $objDocument, Core_Data_UDD_Structure_Database $objDatabase, $strName, $strPrefix ) {
        $this->Document = $objDocument;
        $this->Database = $objDatabase;
        $this->FieldCollection = new ArrayObject ();
        $this->strName = $strName;
        $this->strPrefix = $strPrefix;
    }

    function __toString () {
        return ( $this->getPrefix() ) ? $this->getPrefix() . "_" . $this->getName() : $this->getName();
    }

    public function addField ( $strName, $constDataType = Core_Data_UDD_DataType::TEXT ) {
        $Field = new Core_Data_UDD_Field ( $this, $strName, $constDataType );
        $this->FieldCollection[$Field] = $Field;
        return $Field;
    }

    public function fields () {
        return $this->FieldCollection;
    }

    public function getName () {
        return $this->strName;
    }

    public function getPrefix () {
        return $this->strPrefix;
    }

    public function getParent () {
        return $this->objParent;
    }

    public function setParent ( $objParent ) {
        $this->objParent = $objParent;
    }

}

?>
